﻿using System;
using System.Data;
using System.Linq;
using WPFExcelReport.Helpers;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{
    public partial class ITXEXRPT
    {

        private void JLTWB02(DataSet db)
        {
            try
            {
                DataTable tbWBBST = db.Tables["WBBST"];  
                DataTable dtOutput = new DataTable();
                int idx = 1;
                #region======Title===========
                exAgent.SetCellValue(1, idx++, "花型号"); dtOutput.Columns.Add("WBBART", typeof(System.String));
                exAgent.SetCellValue(1, idx++, "小花号"); dtOutput.Columns.Add("WBBFARBE", typeof(System.String));
                exAgent.SetCellValue(1, idx++, "段数"); dtOutput.Columns.Add("NRCOUNT", typeof(System.String)); 
                exAgent.SetCellValue(1, idx++, "数量（米）"); dtOutput.Columns.Add("WBBISTKLG", typeof(System.String));
                exAgent.SetCellValue(1, idx++, "数量（码）"); dtOutput.Columns.Add("WBBISTKLGM", typeof(System.String));
      
                #endregion 
                dtOutput.Merge(tbWBBST, false, MissingSchemaAction.Ignore);  
               foreach (DataRow row in dtOutput.Rows)
                {
                   double lg= System.Convert.ToDouble(row["WBBISTKLG"].ToString())*0.001;
                   row["WBBISTKLG"] = Helper.RoundX(lg , 100);
                    row["WBBISTKLGM"] =Helper.RoundX(lg/0.9144,10); 
                }
                exAgent.DataTableToExcel(dtOutput, 2, 1);
                exAgent.SetCellValue(1, 1, "花型号");
               int count = dtOutput.Rows.Count; 
               exAgent.BatchConvert2Number(2, 3, count+1 , 5);
               exAgent.SetCellValue(1, 1, "花型号");
               
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        } 
    }
}